<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;
use function Symfony\Component\Translation\t;

class CompletionResource extends JsonResource
{
    /**
     * @param \Illuminate\Http\Request $request
     * @return array
     */
    public function toArray($request)
    {
        return [
            'id' => $this->id,
            'stream' => (boolean)$this->stream,
            'model' => $this->model,
            'image_token' => $this->image_token,
            $this->model . '_token' => $this->text_token,
            'params' => json_decode($this->params,1),
            'response' => json_decode($this->text_response,1)
        ];
    }
}
